#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

#define in read()

int read(){
	int x = 0,sgn = 1;char ch = getchar();
	for(;!isdigit(ch);ch = getchar()) if(ch == '-') sgn = -1;
	for(;isdigit(ch);ch = getchar()) x = (x<<1)+(x<<3)+(ch^48);
	return x*sgn;
}

const int MAXN = 1e5+10;

int f[MAXN],n,tot,x,y;
struct line{int l,r;}l[MAXN];
bool operator < (line a,line b){return a.r < b.r || (a.r == b.r && a.l < b.l);}

int main (){
	n = in;
	for(int i = 1;i <= n;i++) {x = in,y = in;if(x + y < n){l[++tot] = (line){x+1,n-y};}}
	sort(l+1,l+tot+1);
	for(int i = 1,j = 1;i <= n;i++){
		f[i] = f[i-1];
		if(l[j].r == i){
			while(l[j].r == i){
				int cnt = 1; j++; while(l[j].l == l[j-1].l && l[j].r == i) j++,cnt++;
				f[i] = max(f[i],f[l[j-1].l-1] + min(cnt,i - l[j-1].l + 1));
			}
		}
	}printf("%d\n",n-f[n]);
	return 0;
}

